// SPDX-License-Identifier: GPL-2.0
#ifndef _NF_CONNTRACK_INNER_H
#define _NF_CONNTRACK_INNER_H

#include <net/netfilter/nf_nat.h>

#ifdef CONFIG_ONT_NET_FEATURES

bool nf_nat_tuple_map_valid(struct nf_conntrack_tuple *tuple, const struct nf_nat_range2 *range,
			    const struct nf_conn *ct, enum nf_nat_manip_type maniptype);

void nf_nat_set_sip_exp_hook(void);
void nf_nat_clear_sip_exp_hook(void);

bool nf_nat_masquerade_proto_check(const struct nf_conn *ct);
unsigned int nf_nat_masquerade_setup_info(struct sk_buff *skb, struct nf_conn *ct,
					  const struct nf_conn_nat *nat,
					  const struct nf_nat_range2 *range, __be32 newsrc);

#else /* CONFIG_ONT_NET_FEATURES */

static inline bool
nf_nat_tuple_map_valid(struct nf_conntrack_tuple *tuple, const struct nf_nat_range2 *range,
		       const struct nf_conn *ct, enum nf_nat_manip_type maniptype)
{
	return false;
}

static inline void nf_nat_set_sip_exp_hook(void) { }
static inline void nf_nat_clear_sip_exp_hook(void) { }

static inline bool nf_nat_masquerade_proto_check(const struct nf_conn *ct)
{
	return false;
}

static inline unsigned int
nf_nat_masquerade_setup_info(struct sk_buff *skb, struct nf_conn *ct,
			     const struct nf_conn_nat *nat,
			     const struct nf_nat_range2 *range, __be32 newsrc)
{
	return NF_ACCEPT;
}

#endif /* CONFIG_ONT_NET_FEATURES */

#endif /* _NF_CONNTRACK_INNER_H */
